package com.example.myapplication.service;

import com.example.myapplication.bean.Execution;
import com.example.myapplication.bean.Response;
import com.example.myapplication.util.HttpUtils;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public class ExecutionService{
    private static final String URL = "http://101.43.110.183:8080/execution";
    public Integer addExecution(Execution execution) {
        String  responseJson = HttpUtils.post(URL, execution);
        Gson gson = new Gson();
        Response<Object> response = gson.fromJson(responseJson, new TypeToken<Response<Object>>() {
        }.getType());
        return response.getCode();
    }
}


